import Vue from 'vue'
import Vuex from 'vuex'
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    token: "",
    user_id: "",
    allNum: 0,
    cartData: [],
    nOrder: []
  },
  mutations: {
    add(state, token) {
      state.token = token
      state.user_id = token.user_id
      //  console.log(stete.user);
    },
    tui(state) {
      state.token = ""
    },
    getUser(state) {
      return state.user
    },
      

  },
  actions: {},
  modules: {},
  plugins: [createPersistedState()]
})